<?php

class base_enterprise {

    static $enterp;

    static $version;

    static $token;

    static function set_version($version = '1.0') {
        self::$version = $version;
    }

    static function set_token($token = '962d93c3702255fc40cbcc6fe766c6a8') {
        self::$token = $token;
    }

    static function is_valid($format = 'json', $enterprise_account = '') {
        return true;
    }

    static function set_enterprise_info($arr_enterprise) {
        app::get('base')->setConf('ecos.enterprise_info', serialize($arr_enterprise));
        return true;
    }

    static function get($code = 'ent_id') {
        if (self::$enterp === null) {
            if ($serialize_enterp = app::get('base')->getConf('ecos.enterprise_info')) {
                $enterprise = unserialize($serialize_enterp);
                self::$enterp = $enterprise;
            }
        }
        
        return self::$enterp[$code];
    }

    static function ent_id() {
        return self::get('ent_id');
    }

    static function ent_ac() {
        return self::get('ent_ac');
    }

    static function ent_email() {
        return self::get('ent_email');
    }
}